from django.db import models
from django.contrib import auth

# Create your models here.

class IpVoiceInfo(models.Model):
    asset_status = (
        (0, '在线'),
        (1, '下线'),
        (2, '未知'),
        (3, '故障'),
        (4, '备用'),
    )
    position = models.CharField(max_length=16, verbose_name='楼层')
    department = models.CharField(max_length=16, verbose_name='话机归属部门')
    name = models.CharField(max_length=16, verbose_name='话机名称')
    vlan = models.CharField(max_length=8, verbose_name='VLAN')
    numbers = models.CharField(unique=True,max_length=16, verbose_name='话机号码')
    ipaddress = models.GenericIPAddressField(verbose_name='话机IP')
    memo = models.TextField(null=True, blank=True, verbose_name='备注')
    status = models.SmallIntegerField(choices=asset_status, default=0, verbose_name='设备状态')
    c_time = models.DateTimeField(auto_now_add=True, null=True,verbose_name='登记日期')
    m_time = models.DateTimeField(auto_now=True, null=True,verbose_name='更新日期')
    is_active = models.BooleanField(default=True)

    def __str__(self):
        return '<%s>  %s' % (self.position, self.department)

    class Meta:
        verbose_name = '亚总话机清单'
        verbose_name_plural = "亚总话机清单"
        ordering = ['id']

class stuTest(models.Model):
    name = models.CharField(max_length=8)
    age = models.IntegerField()

class toDo(models.Model):
    data = models.CharField(max_length=32,verbose_name='待办事宜')
    done = models.BooleanField(default=True)